import React from 'react'
import {Outlet, useNavigate, useParams } from 'react-router-dom'
function RouteDemo() {
  const navigate = useNavigate()
  const goToIndex = () => {
    navigate('/')
  }
  const params = useParams()
  return (
    <div className="app">
      <div>订单id: {params.id}</div>
      <button onClick={goToIndex}>点我跳转到首页</button> 
      <Outlet></Outlet>
    </div>
  )
}
// 导出组件
export default RouteDemo